<template>
	<view>
		<view class="policy" v-for="(item,index) in storeLog" :key="index">
			<view class="policy_top">
				<view class="">{{item.createtime}}</view>
				<view class="astatus" :style="item.status==0||item.status==1?'':'background: #FF6161;'">
					{{item.status_text}}
				</view>
			</view>
			<view class="policynum">{{item.money}}</view>
			<view class="policytime">存入{{item.store_day}}天</view>
			<view class="policy_btn" v-if="item.status==0||item.status==1">
				<view class="btn1" @click="btnbalance(item.id)">转入余额</view>
				<view class="btn2" @click="$fun.jump(`./withdrawal?id=8&storeLogid=${item.id}&money=${item.money}`)">提现
				</view>
			</view>
		</view>
		<noneDate v-if="storeLog.length==0"></noneDate>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				storeLog: []
			}
		},
		onShow() {
			this.getstore()
		},
		methods: {
			getstore() {
				this.$fun.ajax.post('butt/storeLog', {}).then(res => {
					this.storeLog = res.data
				})
			},
			btnbalance(id) {
				let _this = this
				uni.showModal({
					title: '确认转入余额吗？',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
							_this.$fun.ajax.post('butt/transferMoney', {
								id: id,
							}).then(res => {
								if (res.code == 1) {
									_this.$fun.msg(res.msg)
									_this.getstore()
								}
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})

			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #F5F1EE;
	}

	.policy {
		width: 690rpx;
		// height: 282rpx;
		background: #FFFFFF;
		border-radius: 24rpx;
		margin: 30rpx auto 0;
		padding: 30rpx;

		&_top {
			font-weight: 400;
			font-size: 24rpx;
			color: #999999;
			display: flex;
			justify-content: space-between;
			align-items: center;

			image {
				width: 74rpx;
				height: 32rpx;
			}

			.astatus {
				width: 74rpx;
				height: 32rpx;
				background: #5BBE73;
				border-radius: 4rpx;
				font-weight: 500;
				font-size: 18rpx;
				color: #FFFFFF;
				line-height: 32rpx;
				text-align: center;
			}
		}

		.policynum {
			font-weight: 500;
			font-size: 48rpx;
			color: #333333;
		}

		.policytime {
			font-weight: 500;
			font-size: 28rpx;
			color: #333333;
		}

		&_btn {
			display: flex;
			justify-content: flex-end;
			margin-top: 30rpx;

			.btn1 {
				width: 204rpx;
				height: 72rpx;
				background: #FFFFFF;
				border-radius: 36rpx;
				border: 2rpx solid #5990FF;
				font-weight: 500;
				font-size: 28rpx;
				color: #5990FF;
				line-height: 72rpx;
				text-align: center;
			}

			.btn2 {
				width: 204rpx;
				height: 72rpx;
				background: #5990FF;
				border-radius: 36rpx;
				font-weight: 500;
				font-size: 28rpx;
				color: #FFFFFF;
				line-height: 72rpx;
				text-align: center;
				margin-left: 30rpx;
			}
		}
	}
</style>